package com.mytime;

import org.restlet.Application;
import org.restlet.Context;
import org.restlet.Restlet;
import org.restlet.routing.Router;

import com.mytime.feeds.Feeder;
import com.mytime.resources.AllCategories;
import com.mytime.resources.AllEvents;
import com.mytime.resources.AllVenues;
import com.mytime.resources.EventInformation;
import com.mytime.resources.EventAndVenueDetails;
import com.mytime.resources.EventsByCategory;
import com.mytime.resources.EventsByRegion;
import com.mytime.resources.VenueResource;

public class MyTimeApplication extends Application {

	public MyTimeApplication(Context context) {
		super(context);
	}
	
	@Override
    public Restlet createInboundRoot() {
        // Create a router Restlet that routes each call to 
		//a new instance of its resource.
        Router router = new Router(this.getContext());

        // Define the different routes.
        router.attach("/events", AllEvents.class);
        router.attach("/events/{event_id}", EventInformation.class);
        router.attach("/events/{event_id}/venues/{venue_id}", EventAndVenueDetails.class);
        
        router.attach("/cities/{city_id}/events", EventsByRegion.class);
        
        router.attach("/categories", AllCategories.class);
        router.attach("/categories/{category_id}/events/{group}", EventsByCategory.class);

        router.attach("/venues", AllVenues.class);
        router.attach("/venues/{venue_id}", VenueResource.class);

        router.attach("/feeder", Feeder.class);
        return router;
	}
	
}